<!DOCTYPE html>
<head>
    <title>邮票制作</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- head 中 -->
    <link rel="stylesheet" th:href="@{/jquery-weui/lib/weui.css}">
    <link rel="stylesheet" th:href="@{/jquery-weui/css/jquery-weui.css}">
    <script type="text/javascript" th:src="@{/jquery-weui/lib/jquery-2.1.4.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jquery-weui/js/jquery-weui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jsfiles/crypto-js.min.js?t=1}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jsfiles/com.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jsfiles/hammer.min.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jsfiles/iscroll-zoom-min.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jsfiles/lrz.all.bundle.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/jsfiles/PhotoClip.js?t=1223}" charset="utf-8"></script>

    <style>
        .the_hand {
            width: 45px;
            height: 45px;
            /* 指定动画效果 */
            animation: name 0.75s ease infinite;
            /* 指定手的浮动 */
            position: absolute;
            z-index: 1;
            margin: 45px 82px;
        }
        @keyframes name{
            0% {transform: scale(1);}
            50% {transform: scale(1.25);}
            100% {transform: scale(1)}
        }
        html{
            height: 100%;
        }
        body{
            width: 100%;
            height:100%;
            overflow: scroll;
        }
        *{
            margin: 0;
            padding: 0;
        }
        .main{
            width: 100%;
            height:100%;
        }
        .flex{
            /*flex 布局*/
            display: flex;
            /*实现垂直居中*/
            align-items: center;
            /*实现水平居中*/
            justify-content: center;
            flex-direction: column;
            text-align: justify;
            width:100%;
            height:310px;
            background: #f6f6f6;
            margin:0 auto;
        }
        .stamps{
            width: 100%;
            background-size: 100% 100%;
            background-repeat: no-repeat;
            background-position: 50%;
            position: relative;
        }
        .small{
            width: 11%;
            height: 14%;
            background-color: #e5e5e5;
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 13px;
            color: #666;
            text-align: center;
        }
        .big {
            width: 35.5%;
            height: 29%;
            background-color: #e5e5e5;
            position: absolute;
            font-size: 13px;
            color: #666;
            text-align: center;
        }
        .wdzpzs{
            width: 100%;
            height: 100%;
            z-index: 100000;
            position: absolute;
            background-color:rgba(0,0,0,0.8);
            background-repeat: no-repeat;
            background: url('') no-repeat center center fixed;
            background-size: cover;
            display: none;
        }
        .container {
            display: flex; /* 使用Flexbox布局 */
            justify-content: center; /* 水平居中 */
            align-items: center; /* 垂直居中 */
            height: 100vh; /* 容器高度设置为视口高度 */
            flex-direction: column;
        }
        .content {
            width: 100%; /* 内容宽度 */
            display: flex; /* 使用Flexbox布局 */
            justify-content: center; /* 水平居中 */
            align-items: center; /* 垂直居中 */
            flex-direction: column;

        }
        .wdzp{
            width: 251px;
            height: 187px;
            margin-left: 36px;
            margin-top: 29px;
        }
        .wdzp_div{
            width:320px;
            height:250px;
            background: url("/stamp/image/gxh_bg.png");
            background-size:100%;
        }
        /* 修改标题的文字大小 */
        .weui-dialog__title {
            font-size: 24px;
        }
        .weui-dialog__bd {
            font-size: 20px;
        }
        /* 修改按钮的文字大小和内边距 */
        .weui-dialog__btn {
            font-size: 20px;
            padding: 10px 20px;
        }
    </style>

</head>
<body>
<input id="uploaderInput1" type="file" accept="image/*" multiple="" style="display: none">
<input id="uploaderInput2" type="file" accept="image/*" multiple="" style="display: none">
<input id="hd_id" name="hd_id" type="hidden" value="">
<input id="xm_id" name="xm_id" type="hidden" value="">
<div id="khxz" class="weui-popup__container popup-bottom">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="weui-msg">
            <div class="weui-msg__text-area">
                <h4 class="weui-msg__title" style="color: #007b44;font-weight: bold;font-size: 18pt">用户协议</h4>
                <div style="font-size: 16pt;color: black;text-align: left;">&ensp;&ensp;&ensp;&ensp;您通过本平台上传照片制作的个性化邮票，仅用于在本平台展示与个人纪念，不涉及任何商业用途或其他二次利用。我们不会将您制作的邮票用于除平台展示外的广告宣传、产品推广、售卖盈利等其他目的。</div>
                <div style="height: 13px;"></div>
                <div style="font-size: 16pt;color: black;text-align: left;">注：只接受中国公民个人肖像照片。照片须为本人真实完整面容。图片中不能出现动物，不能出现任何字样，不能带墨镜帽子。<br></div>
                <br>
                <h4 class="weui-msg__title" style="color: #007b44;font-weight: bold;font-size: 18pt">专属纪念邮票</h4>
                <br>
                <p class="weui-msg__desc" style="font-size: 15pt;color: #0d0d0d;text-align: left">
                    ·产品介绍：个性化邮票1版，含10寸相框。
                </p>
                <div style="height: 3px;"></div>
                <p class="weui-msg__desc" style="font-size: 15pt;color: #0d0d0d;text-align: left">
                    ·价格：60元/套(包邮)，如有兑换码可直接兑换。
                </p>
                <div style="height: 3px;"></div>
                <p class="weui-msg__desc" style="font-size: 15pt;color: #0d0d0d;text-align: left">
                    ·发货时间：下单后3个工作日内发货。
                </p><div style="height: 3px;"></div>
                <p class="weui-msg__desc" style="font-size: 15pt;color: #0d0d0d;text-align: left">
                    ·客服电话：18162604181
                </p><div style="height: 3px;"></div>
                <p class="weui-msg__desc" style="font-size: 15pt;color: #0d0d0d;text-align: left">
                    ·下单后如审核未通过，将在5个工作日内为您退款。
                </p><div style="height: 3px;"></div>
                <p class="weui-msg__desc" style="font-size: 15pt;color: #0d0d0d;text-align: left">
                    ·请勿上传违法、违规图片。
                </p><div style="height: 23px;"></div>

            </div>
        </div>

        <div class="weui-btn-area">
            <a class="weui-btn weui-btn_disabled weui-btn_primary" id="tykhxz" name="tykhxz" href="javascript:" style="background-color: #007b44;color: white;font-size: 18pt;font-weight: bolder">阅读 (1)</a>
        </div>
        <div style="height: 20px;"></div>
    </div>
</div>
<div id="wdzpzs" class="wdzpzs">
    <div class="container">
        <div class="content">
            <div style="z-index: 99999;color: black;font-size: 30pt;font-weight: bolder;padding-bottom: 60px;">预览图</div>
            <div id="wdzp_div" class="wdzp_div">
                <img id="wdzp" src="" class="wdzp">
            </div>
        </div>
        <div style="height: 30px;"></div>
        <table style="width: 100%">
            <tr>
                <td style="text-align: center;padding-left: 15px;"><a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: #007b44;color: white;width: 120px;font-size:16pt;font-weight: bold;border: 1px solid #007b44" onclick="on_gb();">上 一 步</a></td>
                <td style="text-align: center;padding-right: 15px;"><a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: #007b44;color: white;width: 120px;font-size:16pt;font-weight: bold;border: 1px solid #007b44" onclick="on_qd();">下 一 步</a></td>
            </tr>
        </table>
    </div>
</div>
<div class="main">
    <!--通过回调设置背景-->
    <div class="stamps" id="gxhbj">
        <div class="small" style="left: 22.12%;top: 32%;">图2</div>
        <div class="small" style="left: 22.12%;top: 47.58%;">图2</div>
        <div class="small" style="left: 22.12%;top: 62.88%;">图2</div>
        <div class="small" style="left: 22.12%;top: 78.2%;">图2</div>

        <div class="small" style="left: 46.12%;top: 32%;">图2</div>
        <div class="small" style="left: 46.12%;top: 78.2%;">图2</div>

        <div class="small" style="left: 70.12%;top: 32%;">图2</div>
        <div class="small" style="left: 70.12%;top: 47.58%;">图2</div>
        <div class="small" style="left: 70.12%;top: 62.88%;">图2</div>
        <div class="small" style="left: 70.12%;top: 77.8%;">图2</div>


        <div class="big" style="left: 33.51%;top: 47.58%;">图1</div>
    </div>
    <div class="flex" id="tp1">
        <div id="sctpdiv1" style="display: block">
            <img class="the_hand" src="/stamp/image/hand.png" onclick="xztp1();"></img>
            <img id="sctp1" src="/stamp/image/upload_tip.png" width="150px" height="160px" onclick="xztp1();">
        </div>
        <div id="yhtpdiv1" onclick="xztp1();" style="display: none">
            <div id="a1" name="a" style="position: absolute;z-index: 99;pointer-events: none;opacity:0">
                <img id="bj1" src="/stamp/image/icon_sb.jpg" style="">
            </div>
            <div id="yhtp1" style="z-index: -1;"></div>
        </div>
        <div style="height: 10px;"></div>
        <div style="text-align: center;color: red;font-size: 18px;">请选择高清明亮的照片上传，可调整照片到合适位置。</div>
    </div>
    <div class="flex" id="tp2" style="display: none">
        <div id="sctpdiv2" style="display: block">
            <img class="the_hand" src="/stamp/image/hand.png" onclick="xztp2();"></img>
            <img id="sctp2" src="/stamp/image/upload_tip.png" width="150px" height="160px" onclick="xztp2();">
        </div>
        <div id="yhtpdiv2" onclick="xztp2();" style="display: none">
            <div id="a2" name="a1" style="position: absolute;z-index: 99;pointer-events: none;opacity:0">
                <img id="bj2" src="/stamp/image/icon_sb.jpg" style="">
            </div>
            <div id="yhtp2" style="z-index: -1;"></div>
        </div>
        <div style="height: 10px;"></div>
        <div style="text-align: center;color: red;font-size: 18px;">请选择高清明亮的照片上传，可调整照片到合适位置。</div>
    </div>
    <div style="height: 8px;"></div>
    <div>
        <table style="width: 100%">
            <tr>
                <td><a href="javascript:;" id="tp1sc" class="weui-btn weui-btn_primary" style="background-color: #007b44;color: white;width: 80%;font-size:14pt;font-weight: bold" onclick="tp1sc(this);">上传图片1</a></td>
                <td><a href="javascript:;" id="tp2sc" class="weui-btn weui-btn_primary" style="background-color: white;color: #007b44;width: 80%;font-size:14pt;font-weight: bold;border: 1px solid #007b44" onclick="tp2sc(this);">上传图片2</a></td>
            </tr>
        </table>
        <div style="height: 15px"></div>
        <table style="width: 100%;height: 55px;" id="sc1">
            <tr>
                <td style="padding-left: 8px;"><a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: white;color: #007b44;width: 80%;font-size:15pt;font-weight: bold;border: 1px solid #007b44" onclick="hdsy();">回首页</a></td>
                <td>
                    <a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: white;color: #007b44;width: 80%;font-size:15pt;font-weight: bold;border: 1px solid #007b44;" onclick="xztp1();">重新上传</a>
                </td>
                <td style="padding-right: 8px;"><a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: #007b44;color: white;width: 80%;font-size:15pt;font-weight: bold;border: 1px solid #007b44" onclick="hctp();">下一步</a></td>
            </tr>
        </table>
        <table style="width: 100%;height: 55px;display:none;" id="sc2">
            <tr>
                <td style="padding-left: 8px;"><a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: white;color: #007b44;width: 80%;font-size:15pt;font-weight: bold;border: 1px solid #007b44" onclick="hdsy();">回首页</a></td>
                <td>
                    <a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: white;color: #007b44;width: 80%;font-size:15pt;font-weight: bold;border: 1px solid #007b44;" onclick="xztp2();">重新上传</a>
                </td>
                <td style="padding-right: 8px;"><a href="javascript:;" class="weui-btn weui-btn_primary" style="background-color: #007b44;color: white;width: 80%;font-size:15pt;font-weight: bold;border: 1px solid #007b44" onclick="hctp();">下一步</a></td>
            </tr>
        </table>
        <div style="height: 3px"></div>
        <input type="hidden" id="next1">
        <input type="hidden" id="next2">
    </div>

</div>
</body>
<!-- body 最后 -->

<script>

    //客户须知部分，暂时每次进入都显示
    $("#khxz").popup();
    var secs = 1;
    $("#tykhxz").addClass("weui-btn_disabled");
    for(var i=1;i<=secs;i++) {
        window.setTimeout("update(" + i + ")", i * 1000);
    }
    function update(num) {
        if(num == secs) {
            $("#tykhxz").html("我同意");
            $("#tykhxz").removeClass("weui-btn_disabled");
            $("#tykhxz").addClass("close-popup");
        }
        else {
            var printnr = secs-num;
            $("#tykhxz").html("阅读 (" + printnr +")");
        }
    }
    //活动id
    var hd_id = "[[${hd_id}]]";
    var xm_id = "[[${xm_id}]]";
    var adminUrl = "[[${adminUrl}]]";
    //后端地址
    var url = "[[${serverUrl}]]/stamp/h5/api/";
    //图片显示
    var url1 = "[[${serverUrl}]]/stamp/tp/";
    function init_data(){
        $.showLoading("数据加载中...");
        var jsonData = {
            hd_id: hd_id,
            timestamp:new Date().getTime()
        };
        var sendStr = {
            data:encrypt_str(JSON.stringify(jsonData),localStorage.getItem("a_h5"),localStorage.getItem("b_h5"))
        };
        $.ajax({
            type:"post",
            url:url+"get_hd_mb_gxh",
            data:JSON.stringify(sendStr),
            dataType:"json",
            timeout : 10*1000, //超时时间设置，单位毫秒
            crossDomain: true,
            contentType: 'application/json;charset=UTF-8',
            headers: {
                "token": localStorage.getItem("token_h5")
            },
            beforeSend: function(request) {
                request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            },
            success:function(result){
                $.hideLoading();
                if (result.code==0){
                    let rtn = decrypt_str(result.data,localStorage.getItem("a_h5"),localStorage.getItem("b_h5"));
                    console.info("rtn:"+rtn);
                    var d = JSON.parse(rtn);
                    let img = url1+"gxhmb_slt?id="+d.stampHd.urlId;
                    let bj = url1+"hdbj?id="+d.stampHd.urlId;
                    let xk = url1+"gxhxk?id="+d.stampHd.urlId;
                    $("#wdzp_div").css('background-image', "url("+xk+")");
                    $('#gxhbj').css('background-image', "url("+img+")");
                    $("#wdzpzs").css('background-image', "url("+bj+")");
                    $("#hd_id").val(d.stampHd.urlId);
                    $("#xm_id").val(d.stampHd.urlXmId);
                }else if (result.code==500){
                    $.alert("活动加载发生错误！");
                }else {
                    $.alert("活动加载发生错误！");
                }
            },
            error:function(result){
                $.hideLoading();
                $.alert("活动加载发生错误！");
            },complete:function(){
                $.hideLoading();
            }
        });
    }

    //初始化数据
    init_data();


    $(document).ready(function(){
        var screenWidth = window.innerWidth;
        var bigH =  $(".big").height();
        let a = bigH+"px";
        $(".big").css('line-height',a);
    });
    function tp1sc(obj){
        $("#tp1").show();
        $("#tp2").hide();
        $("#sc1").show();
        $("#sc2").hide();
        obj.style.color = "white";
        obj.style.backgroundColor ="#007b44";
        document.getElementById("tp2sc").style.color = "#007b44";
        document.getElementById("tp2sc").style.backgroundColor = "white";
        document.getElementById("tp2sc").style.border = "1px solid #007b44";
    }
    function tp2sc(obj){
        $("#tp2").show();
        $("#tp1").hide();
        $("#sc2").show();
        $("#sc1").hide();
        obj.style.color = "white";
        obj.style.backgroundColor ="#007b44";
        document.getElementById("tp1sc").style.color = "#007b44";
        document.getElementById("tp1sc").style.backgroundColor = "white";
        document.getElementById("tp1sc").style.border = "1px solid #007b44";
    }

    //确定
    function on_qd(){
        window.location.href=adminUrl+"/h5/card/wdzp?hd_id="+$("#hd_id").val()+"&xm_id="+$("#xm_id").val()+"";
    }
    function on_gb(){
        $("#wdzpzs").hide();
    }

    var rank = $(window).width() / 6.4;

    $('#a2').css({
        "width": rank * 2.82+"px",
        "height": rank * 2.82+"px"
    })
    $('#yhtpdiv2').css({
        "width": rank * 2.82+"px",
        "height": rank * 2.82+"px"
    })
    $('#yhtp2').css({
        "width": rank * 2.82+"px",
        "height": rank * 2.82+"px"
    })
    $('#bj2').css({
        "width": rank * 2.82+"px",
        "height": rank * 2.82+"px"
    })

    $('#a1').css({
        "width": "365px",
        "height": "237px"
    })
    $('#yhtpdiv1').css({
        "width": "365px",
        "height": "237px"
    })
    $('#yhtp1').css({
        "width": "365px",
        "height": "237px"
    })
    $('#bj1').css({
        "width": "365px",
        "height": "237px"
    })
    //根据高度，设置
    var kd = $('#gxhbj').width();
    var gd = kd/1.25;
    $('#gxhbj').css({
        "height": gd+"px"
    });

    function xztp1(){
        $("#uploaderInput1").click();
    }
    function xztp2(){
        $("#uploaderInput2").click();
    }
    function dataURLtoFile(dataurl) {
        var arr = dataurl.split(','),
            mime = arr[0].match(/:(.*?);/)[1],
            bstr = atob(arr[1]),
            n = bstr.length,
            u8arr = new Uint8Array(n);
        while (n--) {
            u8arr[n] = bstr.charCodeAt(n);
        }
        return new File([u8arr], 'file.jpg', {
            type: mime
        });
    }
    document.getElementById('yhtpdiv1').addEventListener('touchend', function(e) {
        $("#next1").trigger("click");
        console.info("触发！");
    })

    document.getElementById('yhtpdiv1').addEventListener('gestureend', function(e) {
        $("#next1").trigger("click");
        console.info("触发！");
    })

    document.getElementById('yhtpdiv2').addEventListener('touchend', function(e) {
        $("#next2").trigger("click");
        console.info("触发1！");
    })

    document.getElementById('yhtpdiv2').addEventListener('gestureend', function(e) {
        $("#next2").trigger("click");
        console.info("触发1！");
    })
    var pc1_tp;
    var pc1 = new PhotoClip('#yhtpdiv1', {
        size: [365, 237],
        outputSize: [1500, 975],
        file: '#uploaderInput1',
        view: '#yhtp1',
        ok: '#next1',
        loadStart: function() {
            //alert("竖图开始");
            $("#sctpdiv1").hide();
            $("#yhtpdiv1").show();
            //console.log('开始读取照片');
        },
        loadComplete: function(dataURL) {
            if (dataURL.width < 1000 && dataURL.height < 1000) {
                $.alert("上传图片精度不够，请重新选择图片！推荐大于1000*1000");
                setTimeout(function () {
                    pc1.clear();
                    $(".big").empty();
                    $(".big").html("图1");
                    $("#sctpdiv1").show();
                    $("#yhtpdiv1").hide();
                    $('#uploaderInput1').val('')
                }, 500)
            }else{
                pc1_tp = dataURL.src;
                console.info("loadComplete这里执行");
                // $(".big").empty();
                // $(".big").append("<img id=\"big_img\" src=\""+dataURL.src+"\" style=\"width: 100%;height: 100%\">");
                $('#yhtp1').css('background-image', '');
                setTimeout(function() {
                    $("#next1").trigger("click");
                    console.log("这段代码将在1秒后执行");
                }, 500); // 1000毫秒后执行，即1秒后
            }
        },
        done: function(dataURL) {
            $(".big").empty();
            $(".big").append("<img id=\"big_img\" src=\""+dataURL+"\" style=\"width: 100%;height: 100%\">");
            $('#yhtp1').css('background-image', '');

        },
        fail: function(msg) {
            $.alert(msg, "错误！");
        }
    });

    var pc2_tp;
    var pc2 = new PhotoClip('#yhtpdiv2', {
        size: [rank * 2.82, rank * 2.82],
        outputSize: [1000, 1000],
        file: '#uploaderInput2',
        view: '#yhtp2',
        ok: '#next2',
        loadStart: function() {
            //alert("横图开始");
            $("#sctpdiv2").hide();
            $("#yhtpdiv2").show();
        },
        loadComplete: function(dataURL) {
            if (dataURL.width < 1000 && dataURL.height < 1000) {
                $.alert("上传图片精度不够，请重新选择图片！推荐大于1000*1000");
                setTimeout(function () {
                    pc2.clear();
                    $(".small").empty();
                    $(".small").html("图2");
                    $("#sctpdiv2").show();
                    $("#yhtpdiv2").hide();
                    $('#uploaderInput2').val('')
                }, 500)
            }else{
                pc2_tp = dataURL.src;
                console.info("loadComplete这里执行");
                // $(".big").empty();
                // $(".big").append("<img id=\"big_img\" src=\""+dataURL.src+"\" style=\"width: 100%;height: 100%\">");
                $('#yhtp2').css('background-image', '');
                setTimeout(function() {
                    $("#next2").trigger("click");
                    console.log("这段代码将在1秒后执行");
                }, 500); // 1000毫秒后执行，即1秒后
            }
        },
        done: function(dataURL) {
            $(".small").empty();
            $(".small").append("<img id=\"small_img\" src=\""+dataURL+"\" style=\"width: 100%;height: 100%\">");
            $('#yhtp2').css('background-image', '');
        },
        fail: function(msg) {
            $.alert(msg);
        }
    });
    //需要切换图片
    function hctp(){
        $.showLoading("图片合成传中...");
        $("#next1").trigger("click");
        $("#next2").trigger("click");
        setTimeout(() => {
            var hdid = hd_id;
            if (hdid==""){
                $.alert("活动信息丢失！");
                $.hideLoading();
                return;
            }
            let imgDate1 = $("#small_img").attr("src");
            let imgDate2 = $("#big_img").attr("src");

            if (!imgDate1) imgDate1="";
            if (!imgDate2) imgDate2="";
            if (imgDate2==""){
                $.alert("请上传图片1！");
                $("#tp1sc").trigger("click");
                $.hideLoading();
                return;
            }
            if (imgDate1==""){
                $.alert("请上传图片2！");
                $("#tp2sc").trigger("click");
                $.hideLoading();
                return;
            }


            //$.showLoading("图片合成传中...");
            $.ajax({
                type: "post",        // 请求方式
                url: url+"gxh_tp1", // 请求路径
                dataType:"json",
                crossDomain: true,
                headers: {
                    "token": localStorage.getItem("token_h5")
                },
                data: {"imgDate1": imgDate1,"hdid":hdid},
                success: function (res) {   // data是形参名，代表返回的数据
                    let jsonObject = eval(res);
                    let bz = jsonObject.bz;
                    let card_id = jsonObject.card_id;
                    if (bz=="fail"){
                        $.alert("图片生成失败!", "错误！");
                        $.hideLoading();
                    }else {
                        $.ajax({
                            type: "post",        // 请求方式
                            url: url+"gxh_tp2", // 请求路径
                            dataType:"json",
                            data: {"imgDate2": imgDate2,"card_id":card_id},
                            crossDomain: true,
                            headers: {
                                "token": localStorage.getItem("token_h5")
                            },
                            success: function (res) {   // data是形参名，代表返回的数据
                                let jsonObject = eval(res);
                                let bz = jsonObject.bz;
                                let card_id = jsonObject.card_id;
                                if (bz=="fail"){
                                    $.alert("图片生成失败!", "错误！");
                                }else {
                                    $.ajax({
                                        type: "post",        // 请求方式
                                        url: url+"qrta1", // 请求路径
                                        dataType:"json",
                                        data: {"card_id":card_id},
                                        crossDomain: true,
                                        headers: {
                                            "token": localStorage.getItem("token_h5")
                                        },
                                        success: function (res) {   // data是形参名，代表返回的数据
                                            let jsonObject = eval(res);
                                            let bz = jsonObject.bz;
                                            let card_id = jsonObject.card_id;
                                            if (bz=="fail"){
                                                $.alert("图片生成失败!", "错误！");
                                            }else {
                                                $("#wdzp").attr('src', url1+"wdzp_gxh?id="+card_id+"&token="+localStorage.getItem("token_h5"));
                                                // $("#wdzp").height(320);
                                                // $("#wdzp").width("90%");
                                                $("#wdzpzs").show();
                                            }
                                        },
                                        error:function(res){
                                            $.alert("服务器未响应！合成图片生成失败", "错误！");
                                        },
                                        complete:function(res){
                                            $.hideLoading();
                                        }
                                    });
                                }
                            },
                            error:function(res){
                                $.alert("服务器未响应！图片2生成失败", "错误！"+JSON.stringify(res));
                                $.hideLoading();
                            }
                        });
                    }
                },
                error:function(res){
                    $.alert("服务器未响应！图片1生成失败", "错误！"+JSON.stringify(res));
                    $.hideLoading();
                }
            });
        }, 1000)


    }

    function hdsy(){
        window.location.href=adminUrl+"/h5/myhome/index?id="+encodeURIComponent(xm_id);
    }

</script>